package org.jgs1904.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: 默苍璃
 * @date: 2023-05-11 13:50
 * @Controller注解的类会自动添加到Spring上下文中
 */
@Controller
public class ControllerTest2 {

    /**
     * 映射访问路径
     *
     * @param model
     * @return
     */
    //
    @RequestMapping("/hello2")
    public String index(Model model) {
        //Spring MVC会自动实例化一个Model对象用于向视图中传值       
        model.addAttribute("msg", "ControllerTest2");
        //返回视图位置       
        return "hello";
    }

}
